﻿using UnityEngine;

public class ShopPanel : UIBoxBase
{
    public override void ShowBox()
    {
        base.ShowBox();
    }

    private void OnEnable()
    {
        //EventManager2.RewardAdsPlaySuccess += OnRewardAdsPlaySuccess;
    }

    private void OnDisable()
    {
        //EventManager2.RewardAdsPlaySuccess -= OnRewardAdsPlaySuccess;
    }

    public void OnCloseButtonClick()
    {
        AudioController.Play("PanelClose");
        HideBox();

        if (!GameManager.instance.CurrentData.RateComplete)
        {
            UIManager.instance.ShowBox(UIBoxType.RatePanel);
        }
    }

    public void BuyRemoveAds()
    {
        GameManager.instance.CurrentData.NoAds = true;
        //AdsManager.instance.DestroyBanner();
    }

    public void BuyCoin(int number)
    {
        GameManager.instance.CurrentData.CoinNumber += number;
        ParticleManager.instance.PlayPrizeAanimation();
    }

    /*public void WatchAds()
    {
        AudioController.Play("PanelOpen");
        AdsManager.instance.PlayRewardAds(AdsType.GainCoin);
    }*/

    /*public void OnRewardAdsPlaySuccess(AdsType adsType)
    {
        if (adsType != AdsType.GainCoin) return;

        GameManager.instance.CurrentData.CoinNumber += 50;
        ParticleManager.instance.PlayPrizeAanimation();
    }*/

    public void OnPolicyButtonClick()
    {
        AudioController.Play("PanelOpen");
        Application.OpenURL("https://sites.google.com/view/2048shootmerge-privacy");
    }

    public void OnTermButtonClick()
    {
        AudioController.Play("PanelOpen");
        Application.OpenURL("https://sites.google.com/view/2048shootmergeterm-term");
    }
}
